package com.wukang.photovoltaicinspectionpictures.bean

import android.os.Parcel
import android.os.Parcelable

/**
 * 照片数据
 * @author wukang
 */
data class PhotographData(
    /**
     * 是否有开启结果
     */
    var openRet: Boolean,
    /**
     * 是否有关闭结果
     */
    var closeRet: Boolean,
    /**
     * 开启时照片
     */
    var openPath: String? = "",
    /**
     * 关闭时照片
     */
    var closePath: String? = "",
    /**
     * 光伏板位置
     */
    var photovoltaicLocation: String? = "",
    /**
     * 风险等级
     */
    var riskLevel: String? = "",
    /**
     * 标记
     */
    var mark: String? = ""
) : Parcelable {
    constructor(parcel: Parcel) : this(
        parcel.readByte() != 0.toByte(),
        parcel.readByte() != 0.toByte(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString()
    )

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeByte(if (openRet) 1 else 0)
        parcel.writeByte(if (closeRet) 1 else 0)
        parcel.writeString(openPath)
        parcel.writeString(closePath)
        parcel.writeString(photovoltaicLocation)
        parcel.writeString(riskLevel)
        parcel.writeString(mark)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<PhotographData> {
        override fun createFromParcel(parcel: Parcel): PhotographData {
            return PhotographData(parcel)
        }

        override fun newArray(size: Int): Array<PhotographData?> {
            return arrayOfNulls(size)
        }
    }
}
